home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.661 < prev    next >
Text File  |  1992-02-06  |  2KB  |  54 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fswiss Helvetica;}
  2. \paperw13040
  3. \paperh10800
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs28 Window disableDisplay Bug\
  8. \
  9. Q:  In my application when my window becomes the key window or the main window, sometimes it won't display itself.  What's going on?\
  10. \
  11. A:  
  12. \fc0 There is a bug in 2.0 where 
  13. \b display
  14. \b0  will sometimes be disabled in a Window when the window becomes key and/or main.   The result is that a window (or its delegate) will try to do some drawing in its 
  15. \b becomeKeyWindow
  16. \b0  or 
  17. \b becomeMainWindow
  18. \b0  (or 
  19. \b windowDidBecomeKey:
  20. \b0  or 
  21. \b windowDidBecomeMain:
  22. \b0 ) method, and the drawing won't happen because some drawer observes that display is disabled.\
  23. \
  24. Here's a workaround.  You can do this little dance in either your delegate method or your override of Window's 
  25. \b becomeKeyWindow 
  26. \b0 or 
  27. \b windowDidBecomeMain
  28. \b0 .\
  29. \
  30.  
  31. \f1\fs24 - windowDidBecomeMain:win\
  32. \{\
  33.     BOOL displayWasDisabledForActivation = [NXApp _isInvalid] &&\
  34.                                 ![win isDisplayEnabled];\
  35. \
  36.     if (displayWasDisabledForActivation)\
  37.     [win reenableDisplay];\
  38. \
  39. /* whatever you do now... */\
  40. \
  41.     if (displayWasDisabledForActivation)\
  42.     [win disableDisplay];\
  43.     return self;\
  44. \}\
  45.  
  46. \f0\fs28 \
  47. The _isInvalid method is a private method, and as such is undocumented.  Calling this ensures that you are in the case where this bug bites.  We thought this might be prudent in case there was a different time when you really would like display to be disabled. \
  48. \
  49. Verified for 2.0\
  50. \
  51. QA661\
  52. \
  53.  
  54.